package com.shortvedio.search.api;

import com.shortvedio.base.context.BaseContext;
import com.shortvedio.search.service.UserInfoService;
import com.shortvedio.base.model.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserInfoController {

    @Autowired
    private UserInfoService userInfoService;

    @GetMapping("/relation_list")//获取关注列表
    public Result relationList(Long userId){
        if (userId==null){
            userId = BaseContext.getCurrentId();
        }
        Result relationList = userInfoService.getRelationList(userId);
        return relationList;
    }

    @GetMapping("/get_fans_list")//得到粉丝列表
    public Result getFansList(Long userId){
        if (userId==null){
            userId = BaseContext.getCurrentId();
        }
        Result fansList = userInfoService.getFansList(userId);
        return fansList;
    }

    @GetMapping("get_friend_list")//得到朋友列表
    public Result getFriendList(Long friendId){
        Long userId = BaseContext.getCurrentId();
        Result friendList = userInfoService.getFriendList(userId);
        return friendList;
    }

    @GetMapping("get_self_all")//得到用户自己的信息
    public Result getSelfAll(){
        Long userId = BaseContext.getCurrentId();
        Result userAllInfo = userInfoService.getSelfAllInfo(userId);
        return userAllInfo;
    }

    @GetMapping("get_user_all")//得到其他用户的信息
    public Result getUserAll(Long userId){
        Result userAllInfo = userInfoService.getUserAllInfo(userId);
        return userAllInfo;
    }

    @GetMapping("/search_user")//搜索用户
    public Result SearchUser(String keyWord){
        Result result = userInfoService.searchUserInfo(keyWord);
        return result;
    }



}
